package com.micro.entity;

import java.io.*;
import java.util.List;
import java.util.Map;

/**
 * @author dufen
 */
public class ResponseInfo<T> implements Serializable, Externalizable {
    private static final long serialVersionUID = -1016814204441628641L;
    private int code;
    private String message;
    private InputStream inputStream;
    private InputStream errorInputStream;
    private Map<String, List<String>> headerFields;
    private boolean redirect;
    private T body;
    public int getCode() {
        return code;
    }

    public void setCode(int code) {
        this.code = code;
    }

    public String getMessage() {
        return message;
    }

    public void setMessage(String message) {
        this.message = message;
    }

    public InputStream getInputStream() {
        return inputStream;
    }

    public void setInputStream(InputStream inputStream) {
        this.inputStream = inputStream;
    }

    public InputStream getErrorInputStream() {
        return errorInputStream;
    }

    public void setErrorInputStream(InputStream errorInputStream) {
        this.errorInputStream = errorInputStream;
    }

    public Map<String, List<String>> getHeaderFields() {
        return headerFields;
    }

    public void setHeaderFields(Map<String, List<String>> headerFields) {
        this.headerFields = headerFields;
    }

    public boolean isRedirect() {
        return redirect;
    }

    public void setRedirect(boolean redirect) {
        this.redirect = redirect;
    }

    public T getBody() {
        return body;
    }

    public void setBody(T body) {
        this.body = body;
    }

    @Override
    public String toString() {
        return "ResponseInfo{" +
                "code=" + code +
                ", message='" + message + '\'' +
                ", inputStream=" + inputStream +
                ", errorInputStream=" + errorInputStream +
                ", headerFields=" + headerFields +
                '}';
    }

    @Override
    public void writeExternal(ObjectOutput out) throws IOException {

    }

    @Override
    public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {

    }
}
